const Router = require('koa-router')  //注意：引入的方式

const { auth } = require('../middleware/auth.middleware')
const { tagValidator, tagIdValidator, hasTag, hasNotTag} = require('../middleware/tag.middleware')
const {search_tag, add_tag, edit_tag, del_tag } = require('../controller/tag.controller')
const router = new Router({ prefix: '/tag' })

// 查询
router.post('/tagInfo', auth, search_tag)
// 新增
router.post('/add', auth, tagValidator, hasTag, add_tag)
// 修改
router.post('/edit', auth, tagIdValidator, edit_tag)
// 删除
router.post('/del', auth, tagIdValidator, hasNotTag, del_tag);


module.exports = router